package competition;

import utils.FileUtilities;

/**
 * Main entry point for the scg parsing and xml writing infrastructure.
 * @author Brent Kersanske
 *
 */
public class Main {

	/**
	 * Main method for driving the scg parsing and xml writing infrastructure.
	 * @param args
	 */
	public static void main(String[] args) {
		if(args.length == 1) {
			String competitionDirectory = args[0];
			CompetitionModel competitionModel = new CompetitionModel(competitionDirectory);
			competitionModel.parseHistories();
			competitionModel.buildModel();
			FileUtilities.writeXMLToFile(competitionModel, competitionDirectory, "Competition_Manifest");
		} else if(args.length == 2) {
			String competitionDirectory = args[0];
			String outputDirectory		= args[1];
			System.out.println("Parsing " + competitionDirectory + " for histories. Will use " + outputDirectory + " for xml output.");
			CompetitionModel competitionModel = new CompetitionModel(competitionDirectory, outputDirectory);
			competitionModel.parseHistories();
			competitionModel.buildModel();
			FileUtilities.writeXMLToFile(competitionModel, outputDirectory, "Competition_Manifest");
		} else { 
			System.out.println("Must provide a valid single competition directory!");
		}
	}
}
